package org.bit.createThread;

/**
 * 使用 Lambda 表达式
 */
public class Demo05_Create {
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            while (true) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("Lambda 表达式创建线程");
            }
        });
        // 启动线程
        thread.start();
    }


    /*// 使用lambda表达式
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            while (true) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("通过Lambda表达式创建线程...");
            }
        });
        thread.start();
    }*/
}
